package com.uchedao.seller.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.uchedao.seller.R;


/**
 * Description:
 * Date: 2015-10-23  16:51
 * User: wushan
 */
public class TitleLayoutView extends LinearLayout {

    private TextView mBackTv;
    private TextView mTitle;
    public TitleLayoutView(Context context) {
        super(context);
        LayoutInflater.from(context).inflate(R.layout.view_title_back_login,this);
    }

    public TitleLayoutView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.view_title_back_login,this);
    }

    public TitleLayoutView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        LayoutInflater.from(context).inflate(R.layout.view_title_back_login,this);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        initView();
    }

    private void initView(){
        mBackTv = (TextView)findViewById(R.id.title_back);
        mTitle = (TextView)findViewById(R.id.tv_title_name);
    }

    public void setData(String title,OnClickListener listener) {
        mTitle.setText(title);
        mBackTv.setOnClickListener(listener);
    }

    public void setTitle(String title){
        mTitle.setText(title);
    }

}
